package com.ytjj.qmyx.admin.controller;

import com.ytjj.common.api.CommonResult;
import com.ytjj.qmyx.admin.annotation.OperLog;
import com.ytjj.qmyx.admin.constants.SysLogConstants;
import com.ytjj.qmyx.admin.model.request.BankerApplyRequest;
import com.ytjj.qmyx.admin.service.BankerApplyService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 
 *
 * @Version: 1.0
 *
 * 供应商申请 模块
 */
@RestController
@RequestMapping("/bankerApply")
public class BankerApplyController {

    @Resource
    private BankerApplyService bankerApplyService;

    @GetMapping("/list")
    @OperLog(operModule = "供应商申请模块", operDesc = "申请列表", operType = SysLogConstants.OPERATION_SELECT)
    public String selectList(BankerApplyRequest request) {
        return bankerApplyService.newSelectList(request);
    }

    @GetMapping("/downStatus")
    @OperLog(operModule = "供应商申请模块", operDesc = "下架", operType = SysLogConstants.OPERATION_UPDATE)
    public CommonResult downStatus(@RequestParam Integer bankerProductId) {
        bankerApplyService.downStatus(bankerProductId);
        return CommonResult.success();
    }

    @GetMapping("/rollBack")
    @OperLog(operModule = "供应商申请模块", operDesc = "打回", operType = SysLogConstants.OPERATION_UPDATE)
    public CommonResult rollBack(@RequestParam Integer bankerProductId) {
        bankerApplyService.rollBack(bankerProductId);
        return CommonResult.success();
    }

    @GetMapping("/returnBack")
    @OperLog(operModule = "供应商申请模块", operDesc = "驳回", operType = SysLogConstants.OPERATION_UPDATE)
    public CommonResult returnBack(@RequestParam Integer bankerProductId, @RequestParam Integer bankerId, @RequestParam String remark) {
        bankerApplyService.returnBack(bankerProductId, bankerId, remark);
        return CommonResult.success();
    }
}
